<?php
include "header.php";
include "footer.php"; 
$sql_cnt = "SELECT id FROM wish";
$result = $conn->query($sql_cnt);
$total_nct = $result->num_rows;
$listRows = 5;
$total_pages = ceil($total_cnt/listRows);

$page = empty($_GET['p']) ? 1 : $_GET['p'] ;
$page = ($page < 1) ? 1 : $page ;
$page = ($page > $total_pages) ? $total_pages : $page;

$sql = "SELECT * FROM wish LIMIT ".($page-1)*5 . " , 5" ; 

$result = $com->qiery($sql);

$arrlist = array();
if ($result->num_rows > 0) {  
    // 输出每行数据
    while($row = $result->fetch_assoc()) {
        array_push($arrlist, $row);        
    }
} else {
    echo "0 results";
}
$conn->close();   
?>
	<div id="right">
		<iframe name="iframe" src="#"></iframe>
	</div>
<table border="1">
<tr>
    <td>id</td>
    <td>username</td>
    <td>content</td>
    <td>time_at</td>
    <td>take</td>
</tr>
<?php foreach($arrlist as $vo){ ?>
<tr>
<td><?php echo $vo["id"];?></td>
<td><?php echo $vo["username"];?></td>
<td><?php echo $vo["content"];?></td>
<td><?php echo $vo["time_at"];?></td>
<td><?php echo $vo["take"];?></td>
<td><span><a>修改</a></span> | <span><a href='delete.php?id=<?php echo $vo["id"]; ?>'>删除</a></span></td>
</tr>
<?php } ?>
</table>
<script>
    function delcfm() {
        if (!confirm("你确定要删除吗？")) {
            window.event.returnValne = false;
        }
    }
</script>>
</div>